package spzx.controller;

import com.atguigu.spzx.model.dto.order.OrderStatisticsDto;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import com.atguigu.spzx.model.vo.order.OrderStatisticsVo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import spzx.service.OrderInfoService;

@RestController
@RequestMapping("/admin/orderInfo")
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;

    /**
     * 柱状图所需要的信息
     * @param orderStatisticsDto
     * @return
     */
    @GetMapping("getOrderSta")
    public Result getOrderSta(OrderStatisticsDto orderStatisticsDto){
        //OrderStatisticsVo = dateList + amountList
        OrderStatisticsVo orderStatisticsVo = orderInfoService.getOrderStatisticsVo(orderStatisticsDto);
        return Result.build(orderStatisticsVo, ResultCodeEnum.SUCCESS);
    }

}
